function addLoadEvent(a) {
    var b = window.onload;
    if (typeof window.onload != "function") {
        window.onload = a
    } else {
        window.onload = function () {
            b();
            a()
        }
    }
}
function seoAnalytics() {
    var b, g, c, k, f, d, l;
	
	//get cookie
    function i(n) {
        var p = n + "=";
        var e = document.cookie.split(";");
        for (var o = 0; o < e.length; o++) {
            var q = e[o];
            while (q.charAt(0) == " ") {
                q = q.substring(1, q.length)
            }
            if (q.indexOf(p) == 0) {
                return q.substring(p.length, q.length)
            }
        }
        return null
    }
    // ping url
    c = "http://zhaoshang.baidu.com/picture/r/se.gif";
    g = document;
    if (window != top) {
        try {
            g = top.document
        } catch (h) {}
    }
    f = g.title;
    d = g.URL;
    //get uid
    b = i("BAIDUID");
    if (!b) {
        var b = ""
    }
    //get referrer
    k = document.referrer;
    if (!k) {
        try {
            if (window.opener) {
                k = window.opener.location.href
            }
        } catch (h) {}
    }
    //match keywords
    var m = /(?:baidu.com.+?(?:word|wd)=|google.+?q=|soso.+?w=|bing.+?q=|yahoo.+?[\?|&]p=|sogou.+?query=)([^&]*)&*/i;
    var j = m.test(k);
    if (j) {
        l = new Image(1, 1);
        var a = c + "?pt=" + escape(f) + "&pu=" + escape(d) + "&ref=" + escape(k) + "&pid=" + escape(b) + "&rnd=" + Math.round(Math.random() * 100000);
        l.src = a
    }
}
addLoadEvent(seoAnalytics);
